package me.caofeng.service.api;

import com.github.pagehelper.PageInfo;
import me.caofeng.enums.OrderStatus;
import me.caofeng.enums.Role;
import me.caofeng.pojo.Order;
import me.caofeng.pojo.Page;
import me.caofeng.pojo.Response;

import java.sql.SQLException;
import java.util.List;

/**
 * Copyright © 2017曹峰. All rights reserved.
 *
 * @Prject: mall
 * @Package: me.caofeng.service.api
 * @Description:
 * @Author: 曹峰 blog.caofeng.me
 * @Date: 2017-07-01 21:00
 * @Version: V1.0
 */
public interface IOrderService {
    Response<Order> buildOrderFromCart(String userId,Integer addressId) throws SQLException;

    Response<Order> buildOrderFromProduct(String userId ,Integer addressId ,Integer productId,Integer count);

    Response<Order> getOrderDetail(String userId,String orderId);

    /**
     * @Author:曹峰 blog.caofeng.me
     * @Date: 2017/7/3 17:09
     * @Description: 获取订单列表,分页获取
     * @param userId 用户id
     * @param status {@link me.caofeng.enums.OrderStatus 订单状态}
     * @param role  用户角色
    */
    Response<PageInfo<List<Order>>> getOrdersAsPageInfo(String userId , OrderStatus status, Role role, Integer pageNum, Integer pageSize);

    Response<Page<List<Order>>> getOrders(String userId,OrderStatus status , Role role,Integer pageNum, Integer pageSize);

    Response cancelOrder(String userId,String orderId );

    Response deleteOrder(String userId, String orderId);

    /**
     * 发快递
     * @param orderId
     * @param postId
     * @return
     */
    Response sendPost(String orderId, String postId);

    /**
     * @Author:曹峰 blog.caofeng.me
     * @Date: 2017/7/4 1:20
     * @Description: 签收快递
    */
    Response signOrder(String orderId, String userId);
}


